home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group93c.txt / 000068_icon-group-sender _Sat Oct 2 13:49:27 1993.msg < prev    next >
Internet Message Format  |  1994-02-02  |  2KB

  1. Received: by cheltenham.cs.arizona.edu; Thu, 7 Oct 1993 08:41:16 MST
  2. Date: 2 Oct 93 13:49:27 GMT
  3. From: cis.ohio-state.edu!magnus.acs.ohio-state.edu!math.ohio-state.edu!wupost!tulane!cs.cs.uno.edu!uno.edu!KGPL@ucbvax.Berkeley.EDU
  4. Organization: University of New Orleans
  5. Subject: Self-Extending/Modifying Code
  6. Message-Id: <1993Oct2.134927.4078@cs.uno.edu>
  7. Sender: icon-group-request@cs.arizona.edu
  8. To: icon-group@cs.arizona.edu
  9. Status: R
  10. Errors-To: icon-group-errors@cs.arizona.edu
  11.  
  12. Can one write code in Icon that extends or modifies itself during
  13. run-time?  It has been suggested to me that this can be done, but
  14. after reading/browsing (depending on the chapter) the 1990 edition
  15. of the Griswolds' book, I can find no way to do this.  Admittedly
  16. I can use the "create" command to do something like this, but only
  17. if I write the code that I wish to add myself.
  18.  
  19. What I would like to do is something like this...  Imagine a procedure
  20. that randomly generates legal icon procedures.  Procedures that do not
  21. appear anywhere in the code currently being run.  I would like to be
  22. able to generate a totally new procedure, store it as a string (or
  23. whatever is appropriate) in a variable, and then jump command to that
  24. string/program just created.  All of this during run-time.  Something
  25. like:
  26.  
  27. my_program := random_code()
  28. my_program()
  29.  
  30. Ideally, there should be a way to get the origional code to make
  31. changes to itself, as well.  However this is too much to hope for.
  32.  
  33. Any help would be appreciated.
  34.  
  35. kgpl@jazz.ucc.uno.edu
  36.